'use strict';

module.exports = appInfo => {
  const config = exports = {};

  // use for cookie sign key, should change to your own and keep security
  config.keys = appInfo.name + '_1534304805936_5738';


  // 文件上传路径
  config.uploadDir = 'app/public/admin/upload';

  // 配置表单数量
  exports.multipart = {
    fields: '50',
  };
  // 配置mongose连接mongodb数据库
  exports.mongoose = {
    client: {
      url: 'mongodb://127.0.0.1/egg-fai',
      options: {
        useNewUrlParser: true,
      },
    },
  };
  config.logger={
    outputJSON: true,

  }



  // 拦截器
  config.middleware = [ 'adminauth' ];

  config.adminauth = {
    match: '/admin',
  };

  exports.security = {
    csrf: {
      // 判断是否需要 ignore 的方法，请求上下文 context 作为第一个参数
      ignore: ctx => {
        return true;
      },
    },
  };

  return config;
};
